<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const user = {
            data: { name: '张三', age: 10 },
            set age(value) {
                this.data.age = value;
            },
            get age() {
                return this.data.age;
            }
        }
        Object.defineProperty(user,'data',{
            writable:false
        })
        Object.freeze(user);
        user.data.age = 15;
        console.log(user);
        // 使用set同事设置多个属性
        let web = {
            name:'admin',
            url:'zh.com',
            set site(value){
                [this.name,this.url] = value.split(',');
            },
            get site(){
                return {
                    name:this.name,
                    url:this.url
                }
            }
        }
        web.site = '张三,aa.com';
        console.log(web.site)
    </script>
</body>

</html>